package com.senven.type.controller;


import com.senven.common.entity.Type;
import com.senven.common.pojo.vo.CommonResult;
import com.senven.common.pojo.vo.TypeVo;
import com.senven.type.service.TypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author YSH
 * @since 2022-09-01
 */
@RestController
@RequestMapping("/type")
public class TypeController {

    @Autowired
    private TypeService typeService;

    @PostMapping ("findType")
    public CommonResult findType(Integer currentPage,Integer pageSize,@RequestBody TypeVo typeVo){
        CommonResult selectType = typeService.selectType(currentPage, pageSize,typeVo);
        return selectType;
    }


    @PostMapping("/insertType")
    public CommonResult insertType(@RequestBody Type type){
       return typeService.insertType(type);
    }


    @PostMapping("/updateType")
    public CommonResult updateType(@RequestBody Type id) {
        return typeService.updateType(id);
    }


    @PostMapping("/delType")
    public CommonResult delType(Integer id){
        return typeService.delType(id);
    }
}
